package com.jvyou.thread.d01instance;

/**
 * @author 橘柚
 * @version 1.0-SNAPSHOT
 * @Date 2024/7/29 19:55
 * @Description 继承 Thread 类创建线程
 */
public class MyThread extends Thread {

    @Override
    public void run() {
        for (int i = 0; i < 100; i++) {
            System.out.println(getName() + ":hello" + i);
        }
    }

    public static void main(String[] args) {
        MyThread t1 = new MyThread();
        t1.setName("线程1");
        // 启动线程
        t1.start();
        MyThread t2 = new MyThread();
        t2.setName("线程2");
        t2.start();

    }
}
